#include "ShowWinnerScene.h"


ShowWinnerLayer::ShowWinnerLayer()
{

}

ShowWinnerLayer::~ShowWinnerLayer()
{
}

bool ShowWinnerLayer::init()
{
	bool result = false;
	do
	{
		CC_BREAK_IF(! CCLayerColor::initWithColor(ccc4(255, 255, 255, 255)));

		CCLabelTTF* pLabel = CCLabelTTF::create("You Win", "Arial", 24);
        CC_BREAK_IF(! pLabel);

        // Get window size and place the label upper. 
        CCSize size = CCDirector::sharedDirector()->getWinSize();
        pLabel->setPosition(ccp(size.width / 2, size.height - 50));

        // Add the label to HelloWorld layer as a child layer.
        this->addChild(pLabel, 1);

        // 3. Add add a splash screen, show the cocos2d splash image.
        CCSprite* pSprite = CCSprite::create("HelloWorld.png");
        CC_BREAK_IF(! pSprite);

        // Place the sprite on the center of the screen
        pSprite->setPosition(ccp(size.width/2, size.height/2));

        // Add the sprite to HelloWorld layer as a child layer.
        this->addChild(pSprite, 0);

		result = true;
	}
	while(0);

	return result;    
}


ShowWinnerScene::~ShowWinnerScene()
{
	if (_layer)
	{
		_layer->release();
		_layer = NULL;
	}
}

bool ShowWinnerScene::init()
{
	bool result = false;
	do
	{
		CC_BREAK_IF(!CCScene::init());

		_layer = ShowWinnerLayer::create();
		CC_BREAK_IF(!_layer);
		_layer->retain();
		this->addChild(_layer);
		result = true;
	}
	while(0);

	return result;	
}

void ShowWinnerScene::gameLoop(float time)
{

}